/*
 * c7_review5.cpp
 *
 *  Created on: Sep 1, 2013
 *      Author: cyper.yin
 */
#include <iostream>
using namespace std;

double max(const double * arr, int size);

int main_c7r5(int argc, char **argv) {
	double arr[5] = { 1, 2, 3, 4.1, 3.7 };

	cout << "Max is " << max(arr, 5);
}

double max(const double * arr, int size) {
	double result = 0;
	const double * pt;
	pt = arr;
	result = *pt;
	while (pt < arr+size) {
		if (result < *pt) {
			result = *pt;
		}
		pt++;
	}

	return result;
}

